Configure your project’s Info.plist file to ensure the necessary permissions for Bluetooth Low Energy (LE) and local network services are included. (Ensuring Privacy Compliance)
2
If enabling the Data Protection entitlement, allow access after your end users have unlocked their device for the first time after a system restart. (Setting Protection Entitlement)
Configure your app for compliance with Apple’s guidelines for iOS permissions by doing the following. For more information, see the official Apple documentation for Privacy.
1
From Xcode, add a new Custom iOS Target Properties entry:
From the left navigator area, click your project.
In the editor that appears, click Info tab.
Right-click any row in the list, and then select Add Row from the menu.
For instructions on configuring permissions for your app, see Cloud Authentication.
2
From your project’s Info.plistfile, add the following key-value pairs, which display as dismissable prompts to your end users explaining why the app requires certain permissions.
Copy
Ask AI
Key: NSBluetoothAlwaysUsageDescription Type: String Value: Uses Bluetooth to connect and sync with nearby devices Key: NSBluetoothPeripheralUsageDescription Type: String Value: Uses Bluetooth to connect and sync with nearby devices Key: NSLocalNetworkUsageDescription Type: String Value: Uses WiFi to connect and sync with nearby devices Key: NSBonjourServices Type: Array Value: Item0: "\_http-alt.\_tcp." (String)
3
If your end users prefer a language other than English, replace each default string assigned to Value with their language equivalents.
4
From Xcode, ensure your app continues to sync while it runs in the background, as well as when the end-user device is locked by enabling Bluetooth Background Modes:
From the left navigator area, click your project.
Click Signing & Capabilities.
Click + Capability and then, from the modal that appears, search and select Background Modes.
From TARGETS, select your app from the list.
From Background Modes, click to select the following:
If enabling the Data Protection entitlement, allow access after the end user has unlocked their device for the first time after a system restart by setting the entitlement to NSFileProtectionCompleteUntilFirstUserAuthentication.For more information, see the official Apple documentation for Data Protection Entitlement.
Once you’ve set up your environment, import the Ditto SDK in your codebase and obtain your access credentials.
Unless you have a specialized use case, such as a government app, you must connect to the internet at least once before you can sync offline with other peers.
For more information, contact Ditto. (See Contact Us)
1
From the top-most scope of your app’s codebase, add the following to set up authentication and start syncing offline.
2
Replace YOUR_APP_ID and YOUR_PLAYGROUND_TOKEN with your access credentials available from the portal.